package com.aotain.oframework.util.ioc.i18n;

import java.util.Set;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.io.Resource;
import org.springframework.util.Assert;

/**
 * @author Jacob.cw.Zhang@gmail.com
 */
public class MessageSourceAdapter implements InitializingBean {
	
	private Set<Resource> messageBundleList;
	private ExtendedMessageSource messageSource;
	private boolean supportDbMessage;
	
	public void afterPropertiesSet() throws Exception {
		Assert.notNull(messageSource, "Miss-configuration: messageSource is not set");
		Assert.notEmpty(getMessageBundleList());
		getMessageSource().addMessageBundles(getMessageBundleList());
		if(isSupportDbMessage()){
		}
	}

	public Set<Resource> getMessageBundleList() {
		return messageBundleList;
	}

	public void setMessageBundleList(Set<Resource> messageBundleList) {
		this.messageBundleList = messageBundleList;
	}

	public ExtendedMessageSource getMessageSource() {
		return messageSource;
	}

	public void setMessageSource(ExtendedMessageSource messageSource) {
		this.messageSource = messageSource;
	}

	public boolean isSupportDbMessage() {
		return supportDbMessage;
	}

	public void setSupportDbMessage(boolean supportDbMessage) {
		this.supportDbMessage = supportDbMessage;
	}

}
